Full source code website bán hàng thương mại điện tử gần giống shopee
468.836 lượt xem;
1 <?
2 if (isset($_POST['butSaveLoai'])) {
3 $donvi = trim($_POST['txtName']);
4 if ($donvi=="")
5 {
6 echo "<p align=center class='err'>Bạn chưa nhập tên đơn vị</p>";
7 }
8 else
9 {
10 if (!empty($_POST['oldid'])) {
11 $oldid = $_POST['oldid'];
12 $sql = "update donvi set dv_name='".$donvi."',parent_id='vn' where dv_id='".$oldid."'";
13 }
14 else
15 $sql = "insert into donvi (dv_name,dv_dateadded,parent_id) values ('".$donvi."',SYSDATE(),'vn')";
16 if (mysql_query($sql,$con)) {
17 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
18 echo "<script>window.location='index.php?act=donvi&page=".$_REQUEST['page']."'</script>";
19 }
20 else echo "<p align=center class='err'>Không thể cập nhật</p>";
21 }
22 }
23 ?>
24
25 <?
26 if (isset($_GET['id'])) {
27 $oldid=$_GET['id'];
28 $sql = "select * from donvi where dv_id='".$oldid."'";
29 if ($result = mysql_query($sql,$con)) {
30 $row=mysql_fetch_array($result);
31 $donvi=$row['dv_name'];
32 }
33 }
34 ?>
35
36 <form method="POST" name="FormLoaiSP" action="index.php">
37 <input type=hidden name="act" value="donvi_m">
38 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
39 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
40 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
41 <tr>
42 <td width="45%" align="center" class="title" height="20">Thêm mới / Cập nhật : Đơn vị</td>
43 </tr>
44 <tr>
45 <td width="45%">
46 <table border="0" cellpadding="4" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
47 <tr>
48 <td width="15%" class="smallfont">
49 <p align="right">Tên đơn vị</td>
50 <td width="1%" class="smallfont">
51 <font color="#FF0000">*</font></td>
52 <td width="83%" class="smallfont">
53 <INPUT value="<? echo $donvi; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
54 </tr>
55 <tr>
56 <td width="15%" class="smallfont">
57 <p align="right">
58 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
59 <td width="1%" class="smallfont">
60 </td>
61 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
62 </tr>
63 </table>
64 </td>
65 </tr>
66 </table>
67 </form>
2 if (isset($_POST['butSaveLoai'])) {
3 $donvi = trim($_POST['txtName']);
4 if ($donvi=="")
5 {
6 echo "<p align=center class='err'>Bạn chưa nhập tên đơn vị</p>";
7 }
8 else
9 {
10 if (!empty($_POST['oldid'])) {
11 $oldid = $_POST['oldid'];
12 $sql = "update donvi set dv_name='".$donvi."',parent_id='vn' where dv_id='".$oldid."'";
13 }
14 else
15 $sql = "insert into donvi (dv_name,dv_dateadded,parent_id) values ('".$donvi."',SYSDATE(),'vn')";
16 if (mysql_query($sql,$con)) {
17 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
18 echo "<script>window.location='index.php?act=donvi&page=".$_REQUEST['page']."'</script>";
19 }
20 else echo "<p align=center class='err'>Không thể cập nhật</p>";
21 }
22 }
23 ?>
24
25 <?
26 if (isset($_GET['id'])) {
27 $oldid=$_GET['id'];
28 $sql = "select * from donvi where dv_id='".$oldid."'";
29 if ($result = mysql_query($sql,$con)) {
30 $row=mysql_fetch_array($result);
31 $donvi=$row['dv_name'];
32 }
33 }
34 ?>
35
36 <form method="POST" name="FormLoaiSP" action="index.php">
37 <input type=hidden name="act" value="donvi_m">
38 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
39 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
40 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
41 <tr>
42 <td width="45%" align="center" class="title" height="20">Thêm mới / Cập nhật : Đơn vị</td>
43 </tr>
44 <tr>
45 <td width="45%">
46 <table border="0" cellpadding="4" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
47 <tr>
48 <td width="15%" class="smallfont">
49 <p align="right">Tên đơn vị</td>
50 <td width="1%" class="smallfont">
51 <font color="#FF0000">*</font></td>
52 <td width="83%" class="smallfont">
53 <INPUT value="<? echo $donvi; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
54 </tr>
55 <tr>
56 <td width="15%" class="smallfont">
57 <p align="right">
58 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
59 <td width="1%" class="smallfont">
60 </td>
61 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
62 </tr>
63 </table>
64 </td>
65 </tr>
66 </table>
67 </form>